package com.alex.boot.config;

import lombok.Data;
import org.springframework.context.ApplicationEvent;

/**
 * 自定义事件
 */
@Data
public class SendMsgEvent extends ApplicationEvent {

    // 收件人
    private String receiver;

    // 收件内容
    private String content;

    public SendMsgEvent(Object source) {
        this(source, null, null);
    }

    public SendMsgEvent(Object source, String receiver, String content) {
        super(source);
        this.source = source;
        this.content = content;
    }

    public void output() {
        System.out.println("I had been sand a msg to " + this.receiver);
    }
}
